<!DOCTYPE HTML PUBLIC "-//ORA//DTD CD HTML 3.2//EN">
<HTML>
<HEAD>
<TITLE>[Chapter 25] The java.lang Package</TITLE>
<META NAME="author" CONTENT="David Flanagan">
<META NAME="date" CONTENT="Thu Jul 31 16:26:19 1997">
<META NAME="form" CONTENT="html">
<META NAME="metadata" CONTENT="dublincore.0.1">
<META NAME="objecttype" CONTENT="book part">
<META NAME="otheragent" CONTENT="gmat dbtohtml">
<META NAME="publisher" CONTENT="O'Reilly &amp; Associates, Inc.">
<META NAME="source" CONTENT="SGML">
<META NAME="subject" CONTENT="Java">
<META NAME="title" CONTENT="Java in a Nutshell">
<META HTTP-EQUIV="Content-Script-Type" CONTENT="text/javascript">
</HEAD>
<body vlink="#551a8b" alink="#ff0000" text="#000000" bgcolor="#FFFFFF" link="#0000ee">
<script language='JavaScript'>
<!--
if (location.replace) {
 location.replace ('ch25_js.htm');
}
// -->
</script>

<DIV CLASS=htmlnav>
<H1><a href='index.htm'><IMG SRC="gifs/smbanner.gif"
     ALT="Java in a Nutshell" border=0></a></H1>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch24_69.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><B><FONT FACE="ARIEL,HELVETICA,HELV,SANSERIF" SIZE="-1">Chapter 25</FONT></B></TD>
<td width=172 align=right valign=top><A HREF="ch25_02.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
</table>

&nbsp;
<hr align=left width=515>
</DIV>
<H1 CLASS=chapter><A CLASS="TITLE" NAME="JNUT2-CH-25">25. The java.lang Package</A></H1>

<DIV CLASS=htmltoc>

<p>
<b>Contents:</b><br>
<a href='ch25_02.htm'>java.lang.ArithmeticException (JDK 1.0)</a><br>
<a href='ch25_03.htm'>java.lang.ArrayIndexOutOfBoundsException (JDK 1.0)</a><br>
<a href='ch25_04.htm'>java.lang.ArrayStoreException (JDK 1.0)</a><br>
<a href='ch25_05.htm'>java.lang.Boolean (JDK 1.0)</a><br>
<a href='ch25_06.htm'>java.lang.Byte (JDK 1.1)</a><br>
<a href='ch25_07.htm'>java.lang.Character (JDK 1.0)</a><br>
<a href='ch25_08.htm'>java.lang.Class (JDK 1.0)</a><br>
<a href='ch25_09.htm'>java.lang.ClassCastException (JDK 1.0)</a><br>
<a href='ch25_10.htm'>java.lang.ClassCircularityError (JDK 1.0)</a><br>
<a href='ch25_11.htm'>java.lang.ClassFormatError (JDK 1.0)</a><br>
<a href='ch25_12.htm'>java.lang.ClassLoader (JDK 1.0)</a><br>
<a href='ch25_13.htm'>java.lang.ClassNotFoundException (JDK 1.0)</a><br>
<a href='ch25_14.htm'>java.lang.CloneNotSupportedException (JDK 1.0)</a><br>
<a href='ch25_15.htm'>java.lang.Cloneable (JDK 1.0)</a><br>
<a href='ch25_16.htm'>java.lang.Compiler (JDK 1.0)</a><br>
<a href='ch25_17.htm'>java.lang.Double (JDK 1.0)</a><br>
<a href='ch25_18.htm'>java.lang.Error (JDK 1.0)</a><br>
<a href='ch25_19.htm'>java.lang.Exception (JDK 1.0)</a><br>
<a href='ch25_20.htm'>java.lang.ExceptionInInitializerError (JDK 1.1)</a><br>
<a href='ch25_21.htm'>java.lang.Float (JDK 1.0)</a><br>
<a href='ch25_22.htm'>java.lang.IllegalAccessError (JDK 1.0)</a><br>
<a href='ch25_23.htm'>java.lang.IllegalAccessException (JDK 1.0)</a><br>
<a href='ch25_24.htm'>java.lang.IllegalArgumentException (JDK 1.0)</a><br>
<a href='ch25_25.htm'>java.lang.IllegalMonitorStateException (JDK 1.0)</a><br>
<a href='ch25_26.htm'>java.lang.IllegalStateException (JDK 1.1)</a><br>
<a href='ch25_27.htm'>java.lang.IllegalThreadStateException (JDK 1.0)</a><br>
<a href='ch25_28.htm'>java.lang.IncompatibleClassChangeError (JDK 1.0)</a><br>
<a href='ch25_29.htm'>java.lang.IndexOutOfBoundsException (JDK 1.0)</a><br>
<a href='ch25_30.htm'>java.lang.InstantiationError (JDK 1.0)</a><br>
<a href='ch25_31.htm'>java.lang.InstantiationException (JDK 1.0)</a><br>
<a href='ch25_32.htm'>java.lang.Integer (JDK 1.0)</a><br>
<a href='ch25_33.htm'>java.lang.InternalError (JDK 1.0)</a><br>
<a href='ch25_34.htm'>java.lang.InterruptedException (JDK 1.0)</a><br>
<a href='ch25_35.htm'>java.lang.LinkageError (JDK 1.0)</a><br>
<a href='ch25_36.htm'>java.lang.Long (JDK 1.0)</a><br>
<a href='ch25_37.htm'>java.lang.Math (JDK 1.0)</a><br>
<a href='ch25_38.htm'>java.lang.NegativeArraySizeException (JDK 1.0)</a><br>
<a href='ch25_39.htm'>java.lang.NoClassDefFoundError (JDK 1.0)</a><br>
<a href='ch25_40.htm'>java.lang.NoSuchFieldError (JDK 1.0)</a><br>
<a href='ch25_41.htm'>java.lang.NoSuchFieldException (JDK 1.1)</a><br>
<a href='ch25_42.htm'>java.lang.NoSuchMethodError (JDK 1.0)</a><br>
<a href='ch25_43.htm'>java.lang.NoSuchMethodException (JDK 1.0)</a><br>
<a href='ch25_44.htm'>java.lang.NullPointerException (JDK 1.0)</a><br>
<a href='ch25_45.htm'>java.lang.Number (JDK 1.0)</a><br>
<a href='ch25_46.htm'>java.lang.NumberFormatException (JDK 1.0)</a><br>
<a href='ch25_47.htm'>java.lang.Object (JDK 1.0)</a><br>
<a href='ch25_48.htm'>java.lang.OutOfMemoryError (JDK 1.0)</a><br>
<a href='ch25_49.htm'>java.lang.Process (JDK 1.0)</a><br>
<a href='ch25_50.htm'>java.lang.Runnable (JDK 1.0)</a><br>
<a href='ch25_51.htm'>java.lang.Runtime (JDK 1.0)</a><br>
<a href='ch25_52.htm'>java.lang.RuntimeException (JDK 1.0)</a><br>
<a href='ch25_53.htm'>java.lang.SecurityException (JDK 1.0)</a><br>
<a href='ch25_54.htm'>java.lang.SecurityManager (JDK 1.0)</a><br>
<a href='ch25_55.htm'>java.lang.Short (JDK 1.1)</a><br>
<a href='ch25_56.htm'>java.lang.StackOverflowError (JDK 1.0)</a><br>
<a href='ch25_57.htm'>java.lang.String (JDK 1.0)</a><br>
<a href='ch25_58.htm'>java.lang.StringBuffer (JDK 1.0)</a><br>
<a href='ch25_59.htm'>java.lang.StringIndexOutOfBoundsException (JDK 1.0)</a><br>
<a href='ch25_60.htm'>java.lang.System (JDK 1.0)</a><br>
<a href='ch25_61.htm'>java.lang.Thread (JDK 1.0)</a><br>
<a href='ch25_62.htm'>java.lang.ThreadDeath (JDK 1.0)</a><br>
<a href='ch25_63.htm'>java.lang.ThreadGroup (JDK 1.0)</a><br>
<a href='ch25_64.htm'>java.lang.Throwable (JDK 1.0)</a><br>
<a href='ch25_65.htm'>java.lang.UnknownError (JDK 1.0)</a><br>
<a href='ch25_66.htm'>java.lang.UnsatisfiedLinkError (JDK 1.0)</a><br>
<a href='ch25_67.htm'>java.lang.VerifyError (JDK 1.0)</a><br>
<a href='ch25_68.htm'>java.lang.VirtualMachineError (JDK 1.0)</a><br>
<a href='ch25_69.htm'>java.lang.Void (JDK 1.1)</a><br>
<p>
<p>
</DIV>

<P CLASS=para>
The <tt CLASS=literal>java.lang</tt> package contains the classes that are
most central to the Java language. As you can see from
<A HREF="ch25_01.htm#JNUT2-CH-25-FIG-1">Figure 25.1</A>,
the class hierarchy is broad rather than deep, which means
that the classes are independent of each other.<A NAME="CH25.JAVA.LANG.PA1"></A>

<DIV CLASS=figure>
<h4 CLASS=figure><A CLASS="TITLE" NAME="JNUT2-CH-25-FIG-1">Figure 25.1: The java.lang package</A></h4>


<p>
<img align=middle src="./figs/jn2_2501.gif" alt="[Graphic: Figure 25-1]" width=464 height=535 border=0>

</DIV>

<P CLASS=para>
<tt CLASS=literal>Object</tt> is the ultimate superclass of all Java
classes and is therefore at the top of all class
hierarchies. <tt CLASS=literal>Class</tt> is a class that describes a Java
class. There is one <tt CLASS=literal>Class</tt> object for each class
that is loaded into Java.

<P CLASS=para>
<tt CLASS=literal>Boolean</tt>, <tt CLASS=literal>Character</tt>, <tt CLASS=literal>Byte</tt>,
<tt CLASS=literal>Short</tt>, <tt CLASS=literal>Integer</tt>, <tt CLASS=literal>Long</tt>, <tt CLASS=literal>Float</tt>,
and <tt CLASS=literal>Double</tt> are immutable class wrappers around each
of the primitive Java data types. These classes are useful
when you need to manipulate primitive types as objects.
They also contain useful conversion and utility methods.

<P CLASS=para>
<tt CLASS=literal>String</tt> and <tt CLASS=literal>StringBuffer</tt> are objects that
represent strings. <tt CLASS=literal>String</tt> is an immutable type;
<tt CLASS=literal>StringBuffer</tt> may have its string changed in place.

<P CLASS=para>
<tt CLASS=literal>Runtime</tt> provides a number of low-level methods
associated with the Java run-time system. <tt CLASS=literal>System</tt>
provides similar low-level system methods. All the
<tt CLASS=literal>System</tt> methods are class methods, and this class may
not be instantiated. <tt CLASS=literal>Math</tt> is a similar class that
supports only class methods--its methods provide
floating-point math support.

<P CLASS=para>
The <tt CLASS=literal>Thread</tt> class provides support for multiple
threads of control running within the same Java interpreter.
<tt CLASS=literal>Process</tt> defines a platform-independent interface to
platform-dependent processes running externally to the Java
interpreter.

<P CLASS=para>
<tt CLASS=literal>Throwable</tt> is the root class of the exception and
error hierarchy. <tt CLASS=literal>Throwable</tt> objects are used with the
Java <tt CLASS=literal>throw</tt> and <tt CLASS=literal>catch</tt> statements.
<tt CLASS=literal>java.lang</tt> defines quite a few subclasses of
<tt CLASS=literal>Throwable</tt>.  <tt CLASS=literal>Exception</tt> and <tt CLASS=literal>Error</tt> are
the superclasses of all exceptions and errors.
<A HREF="ch25_01.htm#JNUT2-CH-25-FIG-2">Figure 25.2</A>
and
<A HREF="ch25_01.htm#JNUT2-CH-25-FIG-3">Figure 25.3</A>
show the class hierarchies for these core Java exceptions
and errors.

<DIV CLASS=figure>
<h4 CLASS=figure><A CLASS="TITLE" NAME="JNUT2-CH-25-FIG-2">Figure 25.2: The exception classes in the java.lang package</A></h4>


<p>
<img align=middle src="./figs/jn2_2502.gif" alt="[Graphic: Figure 25-2]" width=464 height=332 border=0>

</DIV>

<DIV CLASS=figure>
<h4 CLASS=figure><A CLASS="TITLE" NAME="JNUT2-CH-25-FIG-3">Figure 25.3: The error classes in the java.lang package</A></h4>


<p>
<img align=middle src="./figs/jn2_2503.gif" alt="[Graphic: Figure 25-3]" width=464 height=328 border=0>

</DIV>

<DIV CLASS=sect1>
<h2 CLASS=sect1><A CLASS="TITLE" NAME="JNUT2-CH-25-SECT-1">25.1 java.lang.AbstractMethodError (JDK 1.0)</A></h2>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JNUT2-CH-25-SECT-1.1"></A></h3>
</DIV>

<P CLASS=para>
Signals an attempt to invoke an abstract method.

<DIV CLASS=screen>
<P>
<PRE>
public class <tt CLASS=literal>AbstractMethodError</tt> extends IncompatibleClassChangeError {
    // <tt CLASS=literal>Public Constructors</tt>
            public <tt CLASS=literal>AbstractMethodError</tt>();
            public <tt CLASS=literal>AbstractMethodError</tt>(String <tt CLASS=literal>s</tt>);
}
</PRE>
</DIV>

</DIV>

<DIV CLASS=sect2>
<h3 CLASS=sect2><A CLASS="TITLE" NAME="JNUT2-CH-25-SECT-1.2">Hierarchy:</A></h3>

<P CLASS=para>
Object->Throwable(Serializable)->Error->LinkageError->IncompatibleClassChangeError->AbstractMethodError

</DIV>

</DIV>


<DIV CLASS=htmlnav>

<P>
<HR align=left width=515>
<table width=515 border=0 cellpadding=0 cellspacing=0>
<tr>
<td width=172 align=left valign=top><A HREF="ch24_69.htm"><IMG SRC="gifs/txtpreva.gif" ALT="Previous" border=0></A></td>
<td width=171 align=center valign=top><a href="index.htm"><img src='gifs/txthome.gif' border=0 alt='Home'></a></td>
<td width=172 align=right valign=top><A HREF="ch25_02.htm"><IMG SRC="gifs/txtnexta.gif" ALT="Next" border=0></A></td>
</tr>
<tr>
<td width=172 align=left valign=top>java.io.Writer (JDK 1.1)</td>
<td width=171 align=center valign=top><a href="index/idx_0.htm"><img src='gifs/index.gif' alt='Book Index' border=0></a></td>
<td width=172 align=right valign=top>java.lang.ArithmeticException (JDK 1.0)</td>
</tr>
</table>
<hr align=left width=515>

<IMG SRC="gifs/smnavbar.gif" USEMAP="#map" BORDER=0> 
<MAP NAME="map"> 
<AREA SHAPE=RECT COORDS="0,0,108,15" HREF="../javanut/index.htm"
alt="Java in a Nutshell"> 
<AREA SHAPE=RECT COORDS="109,0,200,15" HREF="../langref/index.htm" 
alt="Java Language Reference"> 
<AREA SHAPE=RECT COORDS="203,0,290,15" HREF="../awt/index.htm" 
alt="Java AWT"> 
<AREA SHAPE=RECT COORDS="291,0,419,15" HREF="../fclass/index.htm" 
alt="Java Fundamental Classes"> 
<AREA SHAPE=RECT COORDS="421,0,514,15" HREF="../exp/index.htm" 
alt="Exploring Java"> 
</MAP>
</DIV>

</BODY>
</HTML>
